Skip to main content

Example: Trace

Product: CODESYS Control

The example shows how to record and store values variables by means of the trace object in the device tree and the Trace visualization element.

_example_img_trace1.png
_example_img_trace2.png

Description

Application: TraceRecordingExample

The application shows how to record and store values of variables by means of the trace object in the device tree and the Trace visualization element. To do this, the application has to be download to the controller and started.

Steps to store and load recordings by means of the Trace visualization element:

  1. In the visualization, adapt the paths for Store trace and Load trace if necessary.

    Note: Absolute paths are not allowed.

  2. Click the Start Trace button to start the trace.

  3. Click the Start recording trigger button to trigger the recording.

  4. Click the Store trace button to store the trace.

  5. Click the Load trace button to load the trace.

    (Restriction: This only works if the trace has been stored with the currently running application.)

Steps to store and load recordings by means of the trace object in the device tree:

  1. Configure whether or not the trace should be started by means of a menu command or a recording condition.

    To do this, in the recording settings (Configuration), select or clear the Enable Trigger option.

  2. Click TraceDownload to download the trace to the controller.

  3. Click TraceStart Trace to start the trace. If you have selected the Enable Trigger option, then the Start Trace menu command is disabled. Then the trace starts automatically after the download and is stopped by the trigger event. The Reset Trigger command restarts the trace.

  4. Click TraceStore Trace to store the trace.

  5. Click TraceLoad Trace to load the trace.

Application: IECTraceConfiguration

The application uses structured text to directly configure a trace element. The corresponding functions of the trace manager are implemented in the CmpTraceMgr library. Trace objects get their data from a package. A package can contain one or more records. The variable to be recorded is assigned to a record.

The PLC_PRG program creates and configures a package and a corresponding record. The FBTracMgr function block encapsulates the functions and handles of the CmpTraceMgr trace manager.

The programmatically configured trace can be loaded into a trace object by means of the TraceUpload Trace command.

System requirements and restrictions

Programming system

CODESYS Development System (version 3.5.14.0 or higher)

Runtime system

CODESYS Control Win (version 3.5.14.0 or higher)

Add-on components

-

Note

_example_icon.png DOWNLOAD Project